﻿<phone:PhoneApplicationPage
    x:Class="Atletika.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <phone:PhoneApplicationPage.Resources>

        <DataTemplate x:Key="ArticleListItem">
            <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="105">
                <!--Replace rectangle with image-->
                <Image Width="119" Source="{Binding FullImagePath}" VerticalAlignment="Top"/>
                <StackPanel Margin="8,-5,0,0">
                    <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeMedium}" />
                    <TextBlock Text="{Binding PublishInfo}" TextWrapping="NoWrap" Margin="10,0" Style="{StaticResource PhoneTextSubtleStyle}" />
                    <TextBlock Text="{Binding Perex}" TextWrapping="NoWrap" Margin="10,-2,10,0" Style="{StaticResource PhoneTextSubtleStyle}" />
                </StackPanel>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="CompetitionListItem">
            <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="95">
                <!--Replace rectangle with image-->
                <Image Width="119" Source="{Binding ImagePath}" VerticalAlignment="Top" />
                <StackPanel Margin="8,-5,0,0">
                    <TextBlock Text="{Binding Name}" TextWrapping="NoWrap"  Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeMedium}" />
                    <TextBlock Text="{Binding City}" TextWrapping="NoWrap" Margin="10,-2,10,0" Style="{StaticResource PhoneTextSubtleStyle}" />
                    <TextBlock Text="{Binding sDate}" TextWrapping="NoWrap" Margin="10,0" Style="{StaticResource PhoneTextSubtleStyle}" />
                </StackPanel>
            </StackPanel>
        </DataTemplate>

    </phone:PhoneApplicationPage.Resources>

    <!-- ROOT -->
    <Grid x:Name="LayoutRoot" Background="Transparent">

         <!-- PANORAMA -->
        <phone:Panorama Title="Slovenská atletika">
            
            <phone:Panorama.Background>
                <ImageBrush ImageSource="/Atletika;component/Assets/PanoramaBackground.png"/>
            </phone:Panorama.Background>

            <!-- AKTUALITY -->
            <phone:PanoramaItem>
                <!--Double line list with image placeholder and text wrapping using a floating header that scrolls with the content-->
                <phone:LongListSelector 
                    Margin="0,-38,-22,2" 
                    ItemsSource="{Binding HomeArticles}" 
                    ItemTemplate="{StaticResource ArticleListItem}">

                    <phone:LongListSelector.ListHeaderTemplate>
                        <DataTemplate>
                            <Grid Margin="12,0,0,18">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <TextBlock Text="Aktuality"
                                           Style="{StaticResource PanoramaItemHeaderTextStyle}"
                                           Grid.Row="0"/>
                            </Grid>
                        </DataTemplate>
                    </phone:LongListSelector.ListHeaderTemplate>

                </phone:LongListSelector>
            </phone:PanoramaItem>

            <!--ZO SVETA-->
            <phone:PanoramaItem>
                <!--Double line list with image placeholder and text wrapping using a floating header that scrolls with the content-->
                <phone:LongListSelector Margin="0,-38,-22,2" ItemsSource="{Binding WorldArticles}" ItemTemplate="{StaticResource ArticleListItem}">
                    <phone:LongListSelector.ListHeaderTemplate>
                        <DataTemplate>
                            <Grid Margin="12,0,0,18">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <TextBlock Text="Zo sveta"
                                           Style="{StaticResource PanoramaItemHeaderTextStyle}"
                                           Grid.Row="0"/>
                            </Grid>
                        </DataTemplate>
                    </phone:LongListSelector.ListHeaderTemplate>
                </phone:LongListSelector>
            </phone:PanoramaItem>

            <!-- PRETEKY -->
            <phone:PanoramaItem>
                <!--Double line list with image placeholder and text wrapping using a floating header that scrolls with the content-->
                <phone:LongListSelector Margin="0,-38,-22,2" ItemsSource="{Binding Competitions}" ItemTemplate="{StaticResource CompetitionListItem}">
                    <phone:LongListSelector.ListHeaderTemplate>
                        <DataTemplate>
                            <Grid Margin="12,0,0,18">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <TextBlock Text="Preteky"
                                           Style="{StaticResource PanoramaItemHeaderTextStyle}"
                                           Grid.Row="0"/>
                            </Grid>
                        </DataTemplate>
                    </phone:LongListSelector.ListHeaderTemplate>
                </phone:LongListSelector>
            </phone:PanoramaItem>

        </phone:Panorama>
    </Grid>
</phone:PhoneApplicationPage>